package com.zzsong.proxy.proxy;

import com.zzsong.proxy.service.DogService;
import com.zzsong.proxy.service.impl.DogServiceImpl;

public class ProxyDog implements DogService {
    private DogServiceImpl dogServiceImpl;
    private String dogName;

    public ProxyDog(String dogName){
        this.dogName=dogName;
    }
    @Override
    public void yell() {
        if (dogServiceImpl==null){
            dogServiceImpl = new DogServiceImpl(dogName);
        }
        dogServiceImpl.yell();
    }
}
